<template>
  <Header></Header>
  <Drawer></Drawer>
  <el-breadcrumb separator="/" style="font-size: 20px;color: #2AB28B;">
    <el-breadcrumb-item :to="{ path: '/Home' }">首页</el-breadcrumb-item>
    <el-breadcrumb-item :to="{ path: '/Home' }">{{ labName }}</el-breadcrumb-item>
    <el-breadcrumb-item :to="{ path: '/ChronicList/'+ids }">档案管理</el-breadcrumb-item>
    <el-breadcrumb-item>新建档案</el-breadcrumb-item>
  </el-breadcrumb>

  <div class = 'pageListBotton'>
    <el-button :icon="Expand" color="#ff5722" style="color: white" round @click="pageList">
      档案列表
    </el-button>

    <span class="onBtnRight"  @click="onHome"><img src="../assets/img/pageList_qiehuan.png" alt=""> 更换群体</span>
  </div>
  <div class="tabInfo">
   <el-tabs v-model="activeName" >
      <el-tab-pane label="基本信息（必填）" name="one">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <div class="bar">
            <div class="w_j" :style="{'color': '#FF5C82','padding':'40px 0 20px 0'}">基本信息 <span :style="{'color': 'red'}">（必填）</span></div>
          </div>

          <el-form-item label="*姓名">
            <el-input v-model="formInline.name" placeholder="姓名必填"></el-input>
          </el-form-item>
          <el-form-item label="* 手机号">
            <el-input v-model="formInline.mobile" placeholder="手机号必填"></el-input>
          </el-form-item>
          <el-form-item label="* 年龄">
            <el-input v-model="formInline.age"  placeholder="年龄必填"></el-input>
          </el-form-item>
           <el-form-item label="* 性别">
            <!-- <el-input v-model="formInline.sex" placeholder="性别必填"></el-input> -->
             <el-select v-model="formInline.sex" placeholder="性别必填">
              <el-option
                  v-for="item in Default.gender"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="* 身高">
            <el-input v-model="formInline.height"  placeholder="身高必填"></el-input>
          </el-form-item>
          <el-form-item label="* 体重">
            <el-input v-model="formInline.weight"  placeholder="体重必填"></el-input>
          </el-form-item>
          <el-form-item label="* 职业">
            <el-input v-model="formInline.occupation"  placeholder="职业必填"></el-input>
          </el-form-item>
         <el-form-item label="* 民族">
            <!-- <el-input v-model="formInline.nation" placeholder="民族必填"></el-input> -->
            <el-select v-model="formInline.nation" placeholder="民族必填">
              <el-option
                  v-for="item in Default.nation"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>

         
          <el-form-item label="* 出生日期">
            <el-config-provider :locale="zhCn">
              <el-date-picker
                  v-model="formInline.birthday"
                  type="date"
                  format="YYYY-MM-DD"
                  value-format="YYYY-MM-DD"
                  placeholder="选择日期" :style="{'width':'100%'}">
              </el-date-picker>
            </el-config-provider>

          </el-form-item>

          <div class="bar">
            <div class="w_j" :style="{'color': '#2AB28B','padding':'40px 0 20px 0'}">其他信息 <span :style="{'color': '#909399'}">（选填）</span></div>
          </div>
         
          <el-form-item label="腹围">
            <el-input v-model="formInline.pre_abdominal_girth" placeholder="请填写腹围"></el-input>
          </el-form-item>
           <el-form-item label="腰围">
            <el-input v-model="formInline.waist" placeholder="请填写腰围"></el-input>
          </el-form-item>
          <el-form-item label="血型">
            <el-select v-model="formInline.xuexing_value" placeholder="请选择血型">
              <el-option
                  v-for="item in Default.bloodGroup"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
         
          <el-form-item label="文化程度">
            <el-select v-model="formInline.jiaoyu_value" placeholder="请选择文化程度">
              <el-option
                  v-for="item in Default.education"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
 <el-form-item label="是否有孩子">
            <!-- <el-input v-model="formInline.havebaby" placeholder="请填写是否有孩子"></el-input> -->
                <el-select v-model="formInline.havebaby" placeholder="请填写是否有孩子">
              <el-option
                  v-for="item in Default.baby"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>

          </el-form-item>


          <div class="next">
            <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('two')">
              保存并下一步
            </el-button>

          </div>
        </el-form>
      </el-tab-pane>

      <el-tab-pane label="主诉与病史（选填）" name="two">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <el-form-item label="头发" style="font-size:30px">
            <el-checkbox-group v-model="formInline.Bad_value" >
              <el-checkbox v-for="item in Default.Hair" :label="item.label" ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
          <div>
         
        </div>
          <div>
            <el-form-item label="眼睛">
              <el-checkbox-group v-model="formInline.eye" >
                <el-checkbox v-for="item in Default.eyes" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="皮肤">
              <el-checkbox-group v-model="formInline.skin" >
                <el-checkbox v-for="item in Default.skin" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="口腔">
              <el-checkbox-group v-model="formInline.oral_cavity" >
                <el-checkbox v-for="item in Default.oral_cavity" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
           <div>
            <el-form-item label="牙齿">
              <el-checkbox-group v-model="formInline.tooth" >
                <el-checkbox v-for="item in Default.tooth" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
             <div>
            <el-form-item label="颈部">
              <el-checkbox-group v-model="formInline.neck" >
                <el-checkbox v-for="item in Default.neck" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
              <div>
            <el-form-item label="神经病变">
             <el-checkbox-group v-model="formInline.Neuropathy" >
                <el-checkbox v-for="item in Default.Neuropathy" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
              <div>
            <el-form-item label="神经症状">
             <el-checkbox-group v-model="formInline.Neurological_symptoms" >
                <el-checkbox v-for="item in Default.Neurological_symptoms" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
              <div>
            <el-form-item label="骨骼">
             <el-checkbox-group v-model="formInline.bones" >
                <el-checkbox v-for="item in Default.bones" :label="item.label" ></el-checkbox>
              </el-checkbox-group>
            </el-form-item>
          </div>
          <div class="bar">
            <div class="w_j" :style="{'color': '#2AB28B','padding':'40px 0 20px 0'}">既往病史 <span :style="{'color': '#909399'}">（选填）</span></div>
          </div>

          <el-input
              type="textarea"
              placeholder="如有病史请在这里填写"
              v-model="formInline.history"
              maxlength="1000"
              show-word-limit
          >
          </el-input>
          
          <div class="next">
            <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('one')">上一步</el-button>
            <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('three')">保存并下一步</el-button>
          </div>

        </el-form>
      </el-tab-pane>
      <el-tab-pane label="膳食与过敏（选填）" name="three">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
        <div class="bar">
          <div class="w_j" :style="{'color': '#2AB28B','padding':'40px 0 20px 0'}">食物过敏 <span :style="{'color': '#909399'}">（选填）</span></div>
        </div>

        <div>
          <el-form-item label="过敏食物" >
            <el-checkbox-group v-model="formInline.allergy_value" >
              <el-checkbox v-for="item in Default.allergy" :label="item.label" ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </div>

        <div>
          <el-form-item label="食物不耐受" >
            <el-checkbox-group v-model="formInline.intolerance_value" >
              <el-checkbox v-for="item in Default.intolerance" :label="item.label" ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </div>
          <div>
          <el-form-item label="已吃以下食物" >
            <el-checkbox-group v-model="formInline.Eaten" >
              <el-checkbox v-for="item in Default.Eaten" :label="item.label" ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </div>
         <div>
          <el-form-item label="未吃以下食物" >
            <el-checkbox-group v-model="formInline.Not_eaten" >
              <el-checkbox v-for="item in Default.NotEaten" :label="item.label" ></el-checkbox>
            </el-checkbox-group>
          </el-form-item>
        </div>

       
        <div class="next">
          <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('two')">上一步</el-button>
          <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('four')">保存并下一步</el-button>
        </div>
        </el-form>
      </el-tab-pane>
      <el-tab-pane label="慢性病调查（选填）" name="four">
        <el-form :inline="true" :model="formInline" class="demo-form-inline">
          <div>
            <el-form-item label="呼吸系统慢性病" >
              <el-select v-model="formInline.Chronic_respiratory_diseases" placeholder="请选择">
                <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="心血管系统慢性病" >
               <el-select v-model="formInline.Chronic_diseases_of_cardiovascular_system" placeholder="请选择">
                <el-option
                v-for="item in options2"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="消化系统" >
               <el-select v-model="formInline.digestive_system" placeholder="请选择">
                <el-option
                v-for="item in options3"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="内分泌系统" >
               <el-select v-model="formInline.endocrine_system" placeholder="请选择">
                <el-option
                v-for="item in options4"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
           <div>
            <el-form-item label="泌尿系统" >
               <el-select v-model="formInline.urinary_system" placeholder="请选择">
                <el-option
                v-for="item in options5"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
           <div>
            <el-form-item label="免疫系统" >
               <el-select v-model="formInline.immune_system" placeholder="请选择">
                <el-option
                v-for="item in options6"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
          <div>
            <el-form-item label="其他类慢性病" >
               <el-select v-model="formInline.Other_chronic_diseases" placeholder="请选择">
                <el-option
                v-for="item in options7"
                :key="item.value"
                :label="item.label"
                :value="item.value">
                </el-option>
            </el-select>
            </el-form-item>
          </div>
        </el-form>

        <div class="next">
          <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onNext('three')">
            上一步
          </el-button>
          <el-button :icon="CircleCheck" color="#ff5722" style="color: white" round @click="onSubmit">
            确认完成
          </el-button>
        </div>
      </el-tab-pane>
    </el-tabs>
  </div>

</template>

<script setup>
import { Edit, CirclePlus, Search, Expand,CircleCheck } from '@element-plus/icons-vue'
import {defineComponent, onMounted, ref, watch, reactive} from 'vue'
import Drawer from './common/Drawer.vue';
import Header from './common/Header.vue';
import {ElMessage} from "element-plus";
import {useRoute, useRouter} from "vue-router"
import zhCn from'element-plus/lib/locale/lang/zh-cn'
import * as api from "../api/loginHttp";
import http from "../utils/http";
import {archivesAdd} from "../api/loginHttp";
const router = useRouter()
const route = useRoute()
const ids = ref()
const labName = ref()
const activeName = ref('one')

const formInline = ref({
  name : '',
  mobile : '',
  age : '',
  height : '',
  tooth:[],
  Chronic_respiratory_diseases:'',
urinary_system:'',
immune_system:'',
Other_chronic_diseases:'',
  birthday:'',
  sex:'',
  bones:[],
  weight : '',
  skin:[],
  Eaten:[],
  occupation:'',
  Neurological_symptoms:[],
  gestational_weeks : '',
  pre_weight : '',
  Neuropathy:[],
  edc : '',
  waist:'',
  nation:'',
  Not_eaten:[],
  twin : '',
  neck:[],
  endocrine_system:'',
  eye:[],
  blood_pressure : '',
  abdominal_girth : '',
  pregnancy_time : '',
  birthday : '',
  pre_abdominal_girth : '',
  xuexing_value : '',
  minzu_value : '',
  Chronic_diseases_of_cardiovascular_system:"",
  jiaoyu_value : '',
  Bad_value:[],
  oral_cavity:[],
  history:'',
  disease_value:[],
  Pastdisease_value:[],
  family_history_value:[],
  habits_value:[],
  edema_value:[],
  digestive_system:'',
  pregnancy_value:[],
  allergy_value:[],
  intolerance_value:[],
  noLikeDiet_value:[],
  LikeDiet_value:[],
  LikeMotion_value:[],
  forbidLikeMotion_value:[],
})
const options=reactive([
    {
          value: '好',
          label: '好'
        },
        {
          value: '一般',
          label: '一般'
        },
        {
          value: '差',
          label: '差'
        },
]);
const options1=reactive([
    {
          value: '慢性咽炎',
          label: '慢性咽炎'
        },
        {
          value: '过敏性鼻炎',
          label: '过敏性鼻炎'
        },
        {
          value: '支气管哮喘',
          label: '支气管哮喘'
        },
         {
          value: '慢性支气管炎',
          label: '慢性支气管炎'
        },
         {
          value: '慢性阻塞性肺疾病',
          label: '慢性阻塞性肺疾病'
        },
         {
          value: '支气管扩张',
          label: '支气管扩张'
        },
        {
          value: '慢性肺源性心脏病',
          label: '慢性肺源性心脏病'
        },
         {
          value: '间质性肺病',
          label: '间质性肺病'
        },
]);
const options2=reactive([
    {
          value: '冠状动脉粥样硬化性心脏病',
          label: '冠状动脉粥样硬化性心脏病'
        },
        {
          value: '慢性心衰',
          label: '慢性心衰'
        },
        {
          value: '风湿性心脏病',
          label: '风湿性心脏病'
        }
]);
const options3=reactive([
    {
          value: '慢性胃肠炎',
          label: '慢性胃肠炎'
        },
        {
          value: '胃十二指肠溃疡',
          label: '胃十二指肠溃疡'
        },
        {
          value: '溃疡性结肠炎',
          label: '溃疡性结肠炎'
        }
]);
const options4=reactive([
    {
          value: '糖尿病',
          label: '糖尿病'
        },
        {
          value: '甲状腺功能减退',
          label: '甲状腺功能减退'
        },
        {
          value: '甲状腺功能亢进',
          label: '甲状腺功能亢进'
        }
]);
const options5=reactive([
    {
          value: '慢性肾炎',
          label: '慢性肾炎'
        },
        {
          value: '慢性肾盂肾炎',
          label: '慢性肾盂肾炎'
        },
        {
          value: '慢性膀胱炎',
          label: '慢性膀胱炎'
        }
]);
const options6=reactive([
    {
          value: '类风湿性关节炎',
          label: '类风湿性关节炎'
        },
        {
          value: '干燥综合症',
          label: '干燥综合症'
        },
]);
const options7=reactive([
    {
          value: '痔疮',
          label: '痔疮'
        },
        {
          value: '子宫肌瘤',
          label: '子宫肌瘤'
        },
         {
          value: '腰椎间盘突出',
          label: '腰椎间盘突出'
        },
         {
          value: '抑郁症',
          label: '抑郁症'
        },
         {
          value: '乙肝',
          label: '乙肝'
        },
         {
          value: '肾结石',
          label: '肾结石'
        },
         {
          value: '前列腺炎',
          label: '前列腺炎'
        },
         {
          value: '痛风',
          label: '痛风'
        },
         {
          value: '脂肪肝',
          label: '脂肪肝'
        },
         {
          value: '高血压',
          label: '高血压'
        },
]);
const Default = reactive({
  gender:[
{  value: '2',
    label: '男'

},
{  value: '1',
    label: '女'

}
  ],
  polyembryony: [
    {
      value: '无',
      label: '无'
    },
    {
      value: '双胎',
      label: '双胎'
    },
    {
      value: '三胎',
      label: '三胎'
    },
    {
      value: '四胎',
      label: '四胎'
    },
    {
      value: '五胎',
      label: '五胎'
    },
    {
      value: '六胎',
      label: '六胎'
    },
    {
      value: '七胎',
      label: '七胎'
    },
    {
      value: '八胎',
      label: '八胎'
    },
  ],
  baby:[
{
   value: '是',
    label: '是'
},
{
   value: '否',
    label: '否'
},

  ],

  tooth:[
   {
    value: '牙龈出血',
    label: '牙龈出血'
    },
    {
    value: '牙齿脱落',
    label: '牙齿脱落'
    }, 
  ],
  //颈部
  neck:[
  {
    value: '甲状腺增生肥大',
    label: '甲状腺增生肥大'
    }, 
  ],
  //神经病变
  Neuropathy:[
    {
    value: '末梢神经炎',
    label: '末梢神经炎'
    }, 
     {
    value: '周围神经变性',
    label: '周围神经变性'
    }, 
  ],
  //神经症状
  Neurological_symptoms:[
    {
    value: '伴有疲乏无力、倦怠、烦躁不安、易激动等',
    label: '伴有疲乏无力、倦怠、烦躁不安、易激动等'
    }, 
     {
    value: '表情冷漠或情绪不好',
    label: '表情冷漠或情绪不好'
    },
     {
    value: '神经异常（如）多疑、抑郁、嗜睡和癔症等',
    label: '神经异常（如）多疑、抑郁、嗜睡和癔症等'
    },
  ],
  //骨骼
  bones:[
    {
    value: '佝偻病',
    label: '佝偻病'
    },
  ],
  //
  oral_cavity:[
    {
    value: '口角炎',
    label: '口角炎'
    },
     {
    value: '舌色变化：牛肉的鲜红色',
    label: '舌色变化：牛肉的鲜红色'
    },
      {
    value: '舌色变化：紫红色',
    label: '舌色变化：紫红色'
    },
      {
    value: '反复口腔溃疡',
    label: '反复口腔溃疡'
    },
    
  ],
  skin:[
   {
        value: '皮肤干燥、脱屑',
        label: '皮肤干燥、脱屑'
   },
     {
        value: '皮肤创伤不易愈合',
        label: '皮肤创伤不易愈合'
   },
   {
        value: '面色苍白',
        label: '面色苍白'
   },
   {
        value: '指甲缺乏光泽',
        label: '指甲缺乏光泽'
   },
    {
        value: '指甲变平',
        label: '指甲变平'
   },
    {
        value: '脂溢性皮炎',
        label: '脂溢性皮炎'
   },
  ],
  eyes:[
      {
        value: '夜盲症或者暗适应降低',
        label: '夜盲症或者暗适应降低'
     },
        {
        value: '眼睛外侧角发湿发红',
        label: '眼睛外侧角发湿发红'
     },
        {
        value: '怕光、烟雾或尘埃刺激',
        label: '怕光、烟雾或尘埃刺激'
     },
        {
        value: '结膜干燥',
        label: '结膜干燥'
     },
        {
        value: '角膜干燥',
        label: '角膜干燥'
     },
        {
        value: '结膜血管充血',
        label: '结膜血管充血'
     },
  ],
  Hair:[
{
    value: '细软',
    label: '细软'
},
{
    value: '稀少',
    label: '稀少'
},
{
    value: '变脆',
    label: '变脆'
},
{
    value: '易脱落',
    label: '易脱落'
},
{
    value: '环形脱发',
    label: '环形脱发'
},
{
    value: '干燥',
    label: '干燥'
},
{
    value: '枕秃',
    label: '枕秃'
},
  ],
  NotEaten:[
{
    value: '冬瓜',
    label: '冬瓜'
},
{
    value: '芹菜',
    label: '芹菜'
},
{
    value: '韭菜',
    label: '韭菜'
},
{
    value: '豆制品',
    label: '豆制品'
},
{
    value: '黄瓜',
    label: '黄瓜'
},
{
    value: '番茄',
    label: '番茄'
},
{
    value: '洋葱',
    label: '洋葱'
},
{
    value: '燕麦',
    label: '燕麦'
},
{
    value: '荞麦',
    label: '荞麦'
},
{
    value: '豆面',
    label: '豆面'
},
{
    value: '小米',
    label: '小米'
},
{
    value: '玉米',
    label: '玉米'
},
  ],
  Eaten:[
{
    value: '火腿',
    label: '火腿'
},
{
    value: '香肠',
    label: '香肠'
},
{
    value: '牛肉干',
    label: '牛肉干'
},
{
    value: '猪肉干',
    label: '猪肉干'
},
{
    value: '肉松',
    label: '肉松'
},
{
    value: '鱼松',
    label: '鱼松'
},
{
    value: '鱼干',
    label: '鱼干'
},
{
    value: '咸蛋',
    label: '咸蛋'
},
{
    value: '肉酱',
    label: '肉酱'
},
{
    value: '各种鱼罐头',
    label: '各种鱼罐头'
},
{
    value: '豆腐干',
    label: '豆腐干'
},
{
    value: '豆腐乳',
    label: '豆腐乳'
},
{
    value: '豆豉',
    label: '豆豉'
},
{
    value: '豆瓣酱',
    label: '豆瓣酱'
},
{
    value: '味精',
    label: '味精'
},
{
    value: '鸡精',
    label: '鸡精'
},

  ],
  bloodGroup: [
    {
      value: 'A型',
      label: 'A型'
    },
    {
      value: 'B型',
      label: 'B型'
    },
    {
      value: 'AB型',
      label: 'AB型'
    },
    {
      value: 'O型',
      label: 'O型'
    },
    {
      value: 'ABO型',
      label: 'ABO型'
    },
    {
      value: 'Rh型',
      label: 'Rh型'
    },
  ],
  Excess_nutrition:[
    {
      value: '糖尿病',
      label: '糖尿病'
    },
     {
      value: '高血压',
      label: '高血压'
    },
     {
      value: '高脂血症',
      label: '高脂血症'
    },
     {
      value: '动脉硬化',
      label: '动脉硬化'
    },
     {
      value: '冠心病',
      label: '冠心病'
    },
     {
      value: '脂肪肝',
      label: '脂肪肝'
    },
     {
      value: '胆结石',
      label: '胆结石'
    },
     {
      value: '痛风',
      label: '痛风'
    },
  ],
  education: [
    {
      value: '博士',
      label: '博士'
    },
    {
      value: '硕士',
      label: '硕士'
    },
    {
      value: '本科',
      label: '本科'
    },
    {
      value: '大专',
      label: '大专'
    },
    {
      value: '高中',
      label: '高中'
    },
    {
      value: '初中及以下',
      label: '初中及以下'
    },
  ],
  nation: [
    {
      value: '汉族',
      label: '汉族'
    },
    {
      value: '壮族',
      label: '壮族'
    },
    {
      value: '满族',
      label: '满族'
    },
    {
      value: '回族',
      label: '回族'
    },
    {
      value: '苗族',
      label: '苗族'
    },
    {
      value: '维吾尔族',
      label: '维吾尔族'
    },
    {
      value: '土家族',
      label: '土家族'
    },
    {
      value: '彝族',
      label: '彝族'
    },
    {
      value: '蒙古族',
      label: '蒙古族'
    },
    {
      value: '藏族',
      label: '藏族'
    },
    {
      value: '布依族',
      label: '布依族'
    },
    {
      value: '侗族',
      label: '侗族'
    },
    {
      value: '瑶族',
      label: '瑶族'
    },
    {
      value: '朝鲜族',
      label: '朝鲜族'
    },
    {
      value: '白族',
      label: '白族'
    },
    {
      value: '哈尼族',
      label: '哈尼族'
    },
    {
      value: '哈萨克族',
      label: '哈萨克族'
    },
    {
      value: '黎族',
      label: '黎族'
    },
    {
      value: '傣族',
      label: '傣族'
    },
    {
      value: '畲族',
      label: '畲族'
    },
    {
      value: '傈僳族',
      label: '傈僳族'
    },
    {
      value: '仡佬族',
      label: '仡佬族'
    },
    {
      value: '东乡族',
      label: '东乡族'
    },
    {
      value: '高山族',
      label: '高山族'
    },
    {
      value: '拉祜族',
      label: '拉祜族'
    },
    {
      value: '水族',
      label: '水族'
    },
    {
      value: '佤族',
      label: '佤族'
    },
    {
      value: '纳西族',
      label: '纳西族'
    },
    {
      value: '羌族',
      label: '羌族'
    },
    {
      value: '土族',
      label: '土族'
    },
    {
      value: '仫佬族',
      label: '仫佬族'
    },
    {
      value: '锡伯族',
      label: '锡伯族'
    },
    {
      value: '柯尔克孜族',
      label: '柯尔克孜族'
    },
    {
      value: '达斡尔族',
      label: '达斡尔族'
    },
    {
      value: '景颇族',
      label: '景颇族'
    },
    {
      value: '毛南族',
      label: '毛南族'
    },
    {
      value: '撒拉族',
      label: '撒拉族'
    },
    {
      value: '布朗族',
      label: '布朗族'
    },
    {
      value: '塔吉克族',
      label: '塔吉克族'
    },
    {
      value: '阿昌族',
      label: '阿昌族'
    },
    {
      value: '普米族',
      label: '普米族'
    },
    {
      value: '鄂温克族',
      label: '鄂温克族'
    },
    {
      value: '怒族',
      label: '怒族'
    },
    {
      value: '京族',
      label: '京族'
    },
    {
      value: '基诺族',
      label: '基诺族'
    },
    {
      value: '德昂族',
      label: '德昂族'
    },
    {
      value: '保安族',
      label: '保安族',
    },
    {
      value: '俄罗斯族',
      label: '俄罗斯族',
    },
    {
      value: '裕固族',
      label: '裕固族',
    },
    {
      value: '乌孜别克族',
      label: '乌孜别克族',
    },
    {
      value: '门巴族',
      label: '门巴族',
    },
    {
      value: '鄂伦春族',
      label: '鄂伦春族',
    },
    {
      value: '独龙族',
      label: '独龙族',
    },
    {
      value: '塔塔尔族',
      label: '塔塔尔族',
    },
    {
      value: '赫哲族',
      label: '赫哲族',
    },
    {
      value: '珞巴族',
      label: '珞巴族',
    },
  ],
  Bad: [
    {
      value: '饮酒',
      label: '饮酒'
    },
    {
      value: '吸烟',
      label: '吸烟'
    },
    {
      value: '素食',
      label: '素食'
    },
  ],
  disease: [
    {
      value: '维生素B缺乏',
      label: '维生素B缺乏'
    },
    {
      value: '维生素C缺乏',
      label: '维生素C缺乏'
    },
    {
      value: '维生素D缺乏',
      label: '维生素D缺乏'
    },
    {
      value: '维生素E缺乏',
      label: '维生素E缺乏'
    },
    {
      value: '维生素A缺乏',
      label: '维生素A缺乏'
    },
    {
      value: '缺锌',
      label: '缺锌'
    },
    {
      value: '缺铁性贫血',
      label: '缺铁性贫血'
    },
  ],
  Pastdisease: [
    {
      value: '心脏类疾病',
      label: '心脏类疾病'
    },
    {
      value: '肾脏类疾病',
      label: '肾脏类疾病'
    },
    {
      value: '肝脏类疾病',
      label: '肝脏类疾病'
    },
    {
      value: '肺脏类疾病',
      label: '肺脏类疾病'
    },
  ],
  family_history:[
    {
      value: '遗传性疾病',
      label: '遗传性疾病'
    },
  ],
   innutrition:[
    {
      value: ' 营养性贫血',
      label: ' 营养性贫血'
    },
     {
      value: '消化道外感染',
      label: '消化道外感染'
    },
     {
      value: '鹅口疮',
      label: '鹅口疮'
    },
     {
      value: '中毒性肝炎',
      label: '中毒性肝炎'
    },
     {
      value: '营养不良和维生素缺乏',
      label: '营养不良和维生素缺乏'
    },
  ],
  bad_habits:[
    {
      value: '节食减肥',
      label: '节食减肥'
    },
    {
      value: '挑食偏食',
      label: '挑食偏食'
    },
    {
      value: '去非正规游泳池',
      label: '去非正规游泳池'
    },
    {
      value: '过度大笑',
      label: '过度大笑'
    },
    {
      value: '取仰卧位睡觉',
      label: '取仰卧位睡觉'
    },
    {
      value: '用水温太高的水洗澡',
      label: '用水温太高的水洗澡'
    },
    {
      value: '每天不按时起居',
      label: '每天不按时起居'
    },
    {
      value: '手机不离手',
      label: '手机不离手'
    },
    {
      value: '用过多电器',
      label: '用过多电器'
    },
    {
      value: '每天看电视',
      label: '每天看电视'
    },
    {
      value: '每天不午休',
      label: '每天不午休'
    },
    {
      value: '熬夜',
      label: '熬夜'
    },
  ],
  Edema:[
    {
      value:'局部肿胀情况较轻',
      label:'局部肿胀情况较轻',
    },
    {
      value:'局部肿胀的硬度',
      label:'局部肿胀的硬度',
    },
    {
      value:'局部肿胀较为严重',
      label:'局部肿胀较为严重',
    }
  ],
  Disease_pregnancy:[
    {
      value: '孕期牙周病',
      label: '孕期牙周病'
    },
    {
      value: '孕期便秘或痔疮',
      label: '孕期便秘或痔疮'
    },
    {
      value: '妊娠糖尿病',
      label: '妊娠糖尿病'
    },
    {
      value: '霉菌性阴道炎',
      label: '霉菌性阴道炎'
    },
    {
      value: '孕期水肿',
      label: '孕期水肿'
    },
    {
      value: '皮肤瘙痒',
      label: '皮肤瘙痒'
    },
    {
      value: '妊娠高血压',
      label: '妊娠高血压'
    },
    {
      value: '产前焦虑症',
      label: '产前焦虑症'
    },
  ],
  allergy:[
    {
      value: '鸡蛋',
      label: '鸡蛋'
    },
    {
      value: '牛奶',
      label: '牛奶'
    },
    {
      value: '花生',
      label: '花生'
    },
    {
      value: '大豆',
      label: '大豆'
    },
    {
      value: '大麦',
      label: '大麦'
    },
    {
      value: '小麦',
      label: '小麦'
    },
    {
      value: '坚果',
      label: '坚果'
    },
    {
      value: '鱼',
      label: '鱼'
    },
    {
      value: '虾',
      label: '虾'
    },
  ],
  intolerance:[
    {
      value: '乳糖',
      label: '乳糖'
    },
    {
      value: '鸡蛋',
      label: '鸡蛋'
    },
  ],
  noLikeDiet:[
    {
      value: '板栗',
      label: '板栗'
    },
    {
      value: '红枣',
      label: '红枣'
    },
    {
      value: '萝卜',
      label: '萝卜'
    },
    {
      value: '柠檬',
      label: '柠檬'
    },
    {
      value: '牛肉',
      label: '牛肉'
    },
    {
      value: '葡萄',
      label: '葡萄'
    },
    {
      value: '酸奶',
      label: '酸奶'
    },
    {
      value: '小米',
      label: '小米'
    },
    {
      value: '核桃',
      label: '核桃'
    },
    {
      value: '海鱼',
      label: '海鱼'
    },
    {
      value: '海参',
      label: '海参'
    },
    {
      value: '野菜',
      label: '野菜'
    },
  ],
  LikeDiet:[
    {
      value: '螃蟹',
      label: '螃蟹'
    },
    {
      value: '海带',
      label: '海带'
    },
    {
      value: '甲鱼',
      label: '甲鱼'
    },
    {
      value: '米仁',
      label: '米仁'
    },
    {
      value: '马齿觅',
      label: '马齿觅'
    },
    {
      value: '杏及杏仁',
      label: '杏及杏仁'
    },
    {
      value: '黑木耳',
      label: '黑木耳'
    },
    {
      value: '山楂',
      label: '山楂'
    },
    {
      value: '罐头食品',
      label: '罐头食品'
    },
    {
      value: '冷饮及汽水',
      label: '冷饮及汽水'
    },
    {
      value: '菠菜',
      label: '菠菜'
    },
    {
      value: '猪肝',
      label: '猪肝'
    },
    {
      value: '久存的土豆',
      label: '久存的土豆'
    },
    {
      value: '花椒、八角、桂皮、五香粉、辣椒',
      label: '花椒、八角、桂皮、五香粉、辣椒'
    },
    {
      value: '油条',
      label: '油条'
    },
    {
      value: '含咖啡因的饮料',
      label: '含咖啡因的饮料'
    },
    {
      value: '辛辣食物',
      label: '辛辣食物'
    },
  ],
  forbidLikeMotion:[

    {
      value: '跳跃',
      label: '跳跃'
    },
    {
      value: '跳高',
      label: '跳高'
    },
    {
      value: '大幅度动作',
      label: '大幅度动作'
    },
    {
      value: '赛跑',
      label: '赛跑'
    },
    {
      value: '爬山',
      label: '爬山'
    },
    {
      value: '爬高',
      label: '爬高'
    },

  ],
  LikeMotion:[
    {
      value: '散步',
      label: '散步'
    },
    {
      value: '瑜伽',
      label: '瑜伽'
    },
    {
      value: '有氧操',
      label: '有氧操'
    },
    {
      value: '游泳',
      label: '游泳'
    },
    {
      value: '跳舞',
      label: '跳舞'
    },
    {
      value: '伸展运动',
      label: '伸展运动'
    },
    {
      value: '重量训练',
      label: '重量训练'
    },
  ],
})
const fetchData = async () => {
  if(route.params.groupId) {
    ids.value = route.params.groupId
    if(ids.value == 3) {
      labName.value = '婴幼儿营养测评'
    } else if(ids.value == 5) {
      labName.value = '孕产妇营养测评'
    } else if(ids.value == 6) {
      labName.value = '成年人营养测评'
    } else if(ids.value == 7) {
      labName.value = '慢性病营养测评'
    } else if (ids.value == 8) {
      labName.value = '团体营养测评'
    } else {
      labName.value = '婴幼儿营养测评'
    }
    formInline.value.group_id = route.params.groupId;
    let id = route.params.id;
    // console.log('api/adult/adultEdit?token='+ window.localStorage.getItem('token') + '&id='+ id)
    http.get('api/Chronic/chronicedit?token='+ window.localStorage.getItem('token') + '&id='+ id).then((res)=>{
      console.log(res.data.data,'慢性病信息')
      if(res.data.code === 1) {
        res.data.data.id = id
      } else {
        ElMessage.error('数据获取失败')
        router.push({'path': '/ChronicList/' + ids.value})
      }
      formInline.value = res.data.data
    })
  } else {
    ElMessage.error('栏目编号不得为空')
    await router.push({'path': '/Home'})
  }
}

const  onSubmit = async () =>{
  if(formInline.value.group_id==''){
    ElMessage.error('所属模块不得为空')
    onNext('one')
    return false;
  }

  if(
         formInline.value.name==''
      || formInline.value.mobile==''
      || formInline.value.age==''
      || formInline.value.gender==''
      || formInline.value.height==''
      || formInline.value.weight==''
      || formInline.value.occupation==''
      || formInline.value.nation==''
      || formInline.value.birthday==''
      // || formInline.value.twin==''
      // || formInline.value.blood_pressure==''
      // || formInline.value.abdominal_girth==''
      // || formInline.value.pregnancy_time==''
  ){
    ElMessage.error('必填项不能为空')
    onNext('one')
    return false;
  }
  let params = formInline._rawValue
 const res = await api.ChronicEdit(params);
  if(res.data.code === 1) {
    ElMessage.success(res.data.msg)
    await router.push({'path': '/ChronicList/' +formInline.value.group_id})
  } else {
    ElMessage.error(res.data.msg)
  }
}

const onNext =  (type) => {
  activeName.value = type
}


const pageList = async () => {
  await router.push({'path': '/ChronicList/' + ids.value})
}

const onHome = async () => {
  await router.push({'path': '/Home'})
}

//自动加载
onMounted(() => {
  fetchData()
})

</script>

<style scoped>
.tabInfo .el-tabs {
  width: 80%;
  margin-top: 40px;
  margin-left: 120px;

}
/deep/ .el-form-item__content .el-input-group {
  vertical-align: top;
  width: 202px;
}

.tabInfo{
  width: 100%;
}
.one{
  padding: 7px 10px;
  margin-right: 5px;
  box-sizing: border-box;
  float: left;
  font-weight: 500;
  font-size: 14px;
  color: #606266;
  cursor: pointer;
}
::v-deep .el-tabs__content {
  margin-left: 5%;
}

::v-deep .el-form-item__label {
  width: 180px;
}
::v-deep .el-form {
  margin: 20px;
}

::v-deep .el-input--prefix .el-input__inner{
  border: 1px solid #ececec;
  width: 202px;
  height: 40px;
  font-size: 14px;
  line-height: 40px;
  border-radius: 2px;
}

.next {
  width: 100%;
  text-align: center;
  padding: 20px 0px;
}
::v-deep .el-input--suffix {
  width: 202px;
}

::v-deep .el-radio-group {
  width: 202px;
}
::v-deep .el-button--success{
  background: #2AB28B;
}
</style>
